import request from '@/utils/request';

export async function getPlantCapacityBaseByPage(params: any) {
  return request('/api/product/getPlantCapacityBaseByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addPlantCapacityBase(params: any) {
  return request('/api/product/addPlantCapacityBase', {
    method: 'POST',
    data: params,
  });
}

export async function updatePlantCapacityBase(params: any) {
  return request('/api/product/updatePlantCapacityBase', {
    method: 'POST',
    data: params,
  });
}

export async function delPlantCapacityBase(params: any) {
  return request('/api/product/delPlantCapacityBase', {
    method: 'POST',
    data: params,
  });
}

export async function exportPlantCapacityBase(params: any) {
  return request('/api/product/exportPlantCapacityBase', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

export async function getAllFactory(params: any) {
  return request('/api/product/getAllFactory', {
    method: 'POST',
    data: params,
  });
}

export async function getAllProcess(params: any) {
  return request('/api/design/getAllProcess', {
    method: 'POST',
    data: params,
  });
}

// 判断某工序是否存在产能
export async function judgePlantCapacityBaseByProcessCode(params: any) {
  return request('/api/product/judgePlantCapacityBaseByProcessCode', {
    method: 'POST',
    params: {
      processCode: params,
    },
  });
}

export default {
  getPlantCapacityBaseByPage,
  addPlantCapacityBase,
  updatePlantCapacityBase,
  delPlantCapacityBase,
  exportPlantCapacityBase,
};
